package service;

import dao.UserDao;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Component("service")
public class UserServiceimpl  implements  UserService{
    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(@Qualifier("userDao") UserDao userDao) {
        this.userDao = userDao;
    }

    //为dao属性注入名为userDao的Bean
    @Autowired
//    @Qualifier("userDao")
    @Resource
    private UserDao userDao;
    //上机3
    public String save(User user){
        return  userDao.save();
    }
}
